<template>
	<view class="wap">
		<navbar :parameter='parameter'></navbar>
		<view class="box form">
			<!-- 姓名 年龄 学历 电话 邮箱 城市 自身优势      -->
			<view class="line acea-row">
				<view class="tit"> 姓名 </view>
				<input type="text" v-model="list.name" placeholder="请输入姓名" placeholder-class="psc">
			</view>
			<view class="line acea-row">
				<view class="tit"> 手机号 </view>
				<input type="number" v-model="list.mobile" placeholder="请输入手机号" placeholder-class="psc">
			</view>
			<view class="line acea-row">
				<view class="tit"> 意见内容 </view>
				<textarea v-model="list.content" placeholder="请输入您的意见反馈" placeholder-class="psc"></textarea>
			</view>
		</view>

		<view class="btn-box">
			<view class="btn" @click="submit"> 提交</view>
		</view>
		<!-- 提示 -->
		<u-toast ref="uToast"></u-toast>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				parameter: {
					'navbar': '1',
					'return': '1',
					'title': '意见反馈',
					'color': false,
				},
				list: {
					name: '',
					mobile: '',
					content: '',
				}

			};
		},
		onLoad() {

		},
		onShow() {

		},
		/**
		 * 用户点击右上角分享
		 */
		onShareAppMessage: function() {

		},
		onShareTimeline(res) { //分享到朋友圈

		},
		methods: {
			// 提交意见反馈
			async sendSuggest() {
				this.list.openid = uni.getStorageSync('openid')
				var that = this;
				const res = await this.$myRequest({
					url: '/api/user/sendSuggest',
					data: that.list
				})
				console.log('提交意见反馈', res.data);
				if (res.data.status == 200) {
					this.$refs.uToast.show({
						type: 'success',
						message: '提交成功',
						complete() {
							uni.navigateBack();
						}
					})
				} else {
					this.$refs.uToast.show({
						type: 'error',
						message: res.data.msg,
					})
				}
			},
			submit() {
				console.log('提交意见反馈', this.list);
				this.sendSuggest()
			}

		}
	}
</script>

<style lang="scss" scoped>
	.wap {
		padding: 20rpx;
	}

	.box {
		width: 100%;
		padding: 0 20rpx;
		background-color: #fff;
		border-radius: 20rpx;
		padding-bottom: 30rpx;
	}

	.form .line {
		font-size: 28rpx;
		line-height: 100rpx;
		border-bottom: 1px solid #D9D9DA;

	}

	.form .line .tit {
		color: #000;
		width: 112rpx;
		text-align-last: justify;
	}

	.form .line input {
		color: #000;
		flex: 1;
		height: 100rpx;
		line-height: 100rpx;
		text-align: right;
	}

	.form .line textarea {
		width: 100%;
		height: 130rpx;
		border: 1px solid #D9D9DA;
		border-radius: 12rpx;
		padding: 20rpx;
		margin-bottom: 20rpx;
		line-height: 1.4;
	}

	.btn-box {
		padding-top: 20rpx;
	}

	.btn-box .btn {
		width: 100%;
		height: 80rpx;
		border-radius: 10rpx;
		line-height: 80rpx;
		text-align: center;
		background-color: #347DFE;
		color: #fff;
		font-size: 32rpx;
	}
</style>
